package cheme.ProcessModel;

import cheme.ProcessModel.ProcessUnits.Streams.AbstractStream;

public class ChemeInitPolicy implements IInitPolicy
{
//	private  Map<Class, Map<String, Integer>> usedStreamIdentifiers = new HashMap<Class, Map<String, Integer>>();
	
	private static ChemeInitPolicy instance = null;
	
	private ChemeInitPolicy()
	{
	}
	
//	private Map<String, Integer> getMap(Class clazz)
//	{
//		Map<String, Integer> map = (Map<String, Integer>)usedStreamIdentifiers.get(clazz);
//		if(null == map)
//		{
//			map = new HashMap<String, Integer>();
//			usedStreamIdentifiers.put(clazz, map);
//		}
//		
//		return map;
//	}
	
	public static ChemeInitPolicy getInstance()
	{
		if(null == instance)
		{
			instance = new ChemeInitPolicy();
		}
		
		return instance;
	}
	
	public void init(Object toInit)
	{
		if(toInit instanceof AbstractStream)
		{
			initStream((AbstractStream)toInit);
		}
	}

	
	private void initStream(AbstractStream stream)
	{
		String identifier = "M";
			
//		Map<String, Integer> map = getMap(stream.getClass());
//		Integer numberSuffix = (Integer)map.get(identifier);
//		if(null == numberSuffix)
//		{
//			numberSuffix = 0;
//		}
//		numberSuffix = numberSuffix.intValue() + 1;
//		map.put(identifier, numberSuffix);
//		identifier = identifier + numberSuffix.toString();
		
//		stream.getTag().getOverallTag().setLabel(identifier);
	}
}
